Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: solve foss source sets and dependencies statically #3082

Conversation

vitorhugods
Copy link
Member


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

When developing F-Droid flavor, the IDE doesn't provide autocompletion and pretty much any other support.

Causes

We're relying on explicit environment variables or invoked task name to figure out whether we should configure F-Droid or not.

The IDE doesn't se these when communicating with Gradle.

Solutions

Just set everything so it works statically, without depending on env variables or tasks being run.

F-Droid flavor is always dependent on prod and foss source sets.
Each other non-free flavor is always dependent on nonfree.

So it looks like this:

%%{init: { "flowchart": { "curve": "linear" } } }%%
flowchart TD
    F(fdroid flavor) --> foss
    F --> p
    P(prod flavor) --> p(prod)
    P --> nonfree
    B(beta flavor) --> beta
    B --> nonfree
    I(internal flavor) --> internal
    I --> nonfree
    D(dev flavor) --> dev
    D --> nonfree
    S(staging flavor) --> nonfree
    S --> staging
Loading

Logs during Gradle configuration:

Adding non-free sourceSets to 'prod' flavor
Adding non-free sourceSets to 'internal' flavor
Adding non-free sourceSets to 'staging' flavor
Adding non-free sourceSets to 'beta' flavor
Adding non-free sourceSets to 'dev' flavor
Adding FOSS sourceSets to 'fdroid' flavor
Adding nonfree libraries to 'prod' flavor
Adding nonfree libraries to 'internal' flavor
Adding nonfree libraries to 'staging' flavor
Adding nonfree libraries to 'beta' flavor
Adding nonfree libraries to 'dev' flavor
Skipping nonfree libraries for 'fdroid' flavor

Attachments

When selecting prodDebug build type in the IDE:

image


When selecting fdroidDebug build type in the IDE:

image


PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@vitorhugods vitorhugods requested review from a team, typfel, yamilmedina, alexandreferris, borichellow and MohamadJaara and removed request for a team June 6, 2024 08:34
@vitorhugods
Copy link
Member Author

There's still a bit of code duplication, as many things are copied/pasted between internal, staging, beta and dev.

Having foss depend on prod source set works for now as they're exactly the same. Perhaps if they deviate in the future, we could rename prod to playstore. And maybe we could have public and private source sets, where foss and prod/playstore could depend on public, and beta, dev, internal, staging could depend on private.

So it would look something like this:

flowchart TD
    playstore --> nonfree
    playstore --> public
    fdroid --> public
    fdroid --> foss
    internal --> private
    internal --> nonfree
    beta --> private
    beta --> nonfree
    dev --> private
    dev --> nonfree
    staging --> private
    staging --> nonfree
Loading

Each flavor's specific sourceset is omitted and as they are only used by their correspondent flavor.

Copy link

sonarqubecloud bot commented Jun 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

github-actions bot commented Jun 6, 2024

Test Results

928 tests   928 ✅  8m 50s ⏱️
123 suites    0 💤
123 files      0 ❌

Results for commit abcff48.

Copy link
Contributor

github-actions bot commented Jun 6, 2024

APKs built during tests are available here. Scroll down to Artifacts!

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@AndroidBob
Copy link
Collaborator

Build 5208 succeeded.

The build produced the following APK's:

@vitorhugods vitorhugods merged commit 9fa0228 into release/candidate Jun 6, 2024
15 checks passed
@vitorhugods vitorhugods deleted the chore/solve-foss-source-sets-and-dependencies-statically branch June 6, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants